<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增系统应用')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-application-add">
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">名称：</label>
			<div class="col-sm-8">
				<input name="appName" class="form-control" type="text" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">类型：</label>
			<div class="col-sm-8">
				<select name="appType" class="form-control m-b" th:with="type=${@dict.getType('sys_app_type')}" required>
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">状态：</label>
			<div class="col-sm-8">
				<div class="radio-box" th:each="dict : ${@dict.getType('sys_common_status')}">
					<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
					<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">排序：</label>
			<div class="col-sm-8">
				<input name="sort" class="form-control" type="number" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label is-required">是否免费：</label>
			<div class="col-sm-8">
				<div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
					<input type="radio" th:id="${'isFree_' + dict.dictCode}" name="isFree" th:value="${dict.dictValue}" th:checked="${dict.default}">
					<label th:for="${'isFree_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
				</div>
			</div>
		</div>
		<div class="form-group" id="freeDate">
			<label class="col-sm-3 control-label is-required">免费使用天数：</label>
			<div class="col-sm-8">
				<input name="freeDate" class="form-control" type="number" min="0" required>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">备注信息：</label>
			<div class="col-sm-8">
				<textarea name="remark" class="form-control"></textarea>
			</div>
		</div>
	</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var prefix = ctx + "system/application"
	$("#form-application-add").validate({
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/add", $('#form-application-add').serialize());
		}
	}

	$(function() {
		$('input').on('ifChecked', function(event){
			var isFree = $(event.target).val();
			$("#freeDate").hide();
			if (isFree == "N") {
				$("#freeDate").show();
			}
		});
	});
</script>
</body>
</html>